<html>
<head>
<script language="javascript" src="http://www.12301.cc/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="http://www.12301.cc/js/global/www.12301.cc.global.js"></script>
<script type="text/javascript" src="http://wx.12301.cc/public/js/common/class.js"></script>
<script type="text/javascript" src="http://wx.12301.cc/public/js/common/ajax.js"></script>
<link rel="stylesheet" href="http://www.12301.cc/css/terminal_dev.css"/>
<link rel="stylesheet" href="http://www.12301.cc/module/zax/baiduline/map_3/css/map_pc.css"/>


</head>
<body>
<div class="compass">     
	<div class="compass_header">
		<div class="compass_order setposition">
			<span class="order_cb">产品：</span>
			<input type="text" class="suggest_input" id="prodSearchInp" autocomplete="off" id="land_a" value="">
			<span class="cleartxt">&#10005;</span>
			<i class="iconfont select_icon">&#xe600;</i>
			<ul class="suggest_ul" style="display: none;"></ul>
			<ul class="prodList" id="prodList"></ul>
			<div class="searchmsg">没有搜索结果</div>
            <input type="hidden"  id="lid_id" value=""/>
		</div>
		
	</div>
	
</div>
<script>
window.onload = function() { 
		


    $('#prodSearchInp').text('');
	$(".cleartxt").click(function(){
		$('#prodSearchInp').val('');
		$(this).css("display","none");
        $("#lid_id").val('');
	});

    $("#prodSearchInp").keyup(function(){
        var sth=$('#prodSearchInp').val();
        var i=0;
        $("#prodList li").each(function(){
            var n=$(this).text().indexOf(sth);
            if(n==-1){
                $(this).css("display","none");
            }else{
                i+=1
                $(this).css("display","block");
            }
        });

        if(i==0){
            $(".searchmsg").css("display","block");
            $("#prodList").css("display","none");
        }else{
            $(".searchmsg").css("display","none");
            $("#prodList").css("display","block");
        }
    });


	//var loc_stor={};
		PFT.Ajax({
			url : "http://www.12301.cc/a/salePros.php?act=lands",
			type : "post",
			dataType : "json",
		},function(res){
			 loc_stor = res;
			list(loc_stor) 
		})
};
function list(lands){
	var list = lands.lists;
	for(var i=0;i<list.length;i++){
	    $("#prodList").append("<li>"+list[i].title+"</li>");
	}
	$("#prodList li").eq(0).addClass("setbg");
	$("#prodList li").click(function(){
		var i=$(this).index();
		$("#prodSearchInp").val(list[i].title);
		$("#prodList li").removeClass("setbg");
		$("#prodList li").eq(i).addClass("setbg");
		$("#prodList").css("display","none"); 
		$("#lid_id").val(list[i].id);
        $(".cleartxt").css("display","block");
	});
	$("#prodSearchInp").click(function(){
        if($("#prodList").css("display")=='block')
            $("#prodList").css("display","none");
        else
		    $("#prodList").css("display","block");
	});
};
 
</script>

</body>
</html>